package com.tutu.service;

import com.tutu.entity.vo.BaseCodeVo;
import com.tutu.exception.ParamErrorException;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * UserService
 */
public interface DeviceService {

    // 查询（分页）
    Map<String, Object> pageByParams(Integer loginCompanyId, Integer companyId, String keyWord, Integer deviceType, Integer stateType, Integer page, Integer limit);

    Map<String, Object> pageByParams(String deviceCode, Integer type, String searchDate, String keyWord, Integer page, Integer limit);

    Map<String, Object> pageByParams(Integer companyId, Integer deviceId, Integer page, Integer limit);

    // 查询详情
    Map<String, Object> getInfoById(Integer id);

    Map<String, Object> getInfoByCode(String deviceCode);

    // 添加 or 修改
    Map<String, Object> saveInfo(HttpServletRequest request, Integer id, Integer deviceType, Integer stateType, Integer companyId, String name, String code, Integer showIndex);

    // 删除
    Map<String, Object> deleteById(HttpServletRequest request, Integer companyId, Integer id);

    // 批量删除
    Map<String, Object> batchDel(HttpServletRequest request, Integer companyId, String ids);

    // 根据公司ID查询该公司的所有设备信息
    List<BaseCodeVo> findListByCompanyId(Integer companyId);

    // 添加设备转发信息
    Map<String, Object> saveForward(HttpServletRequest request, Integer deviceId, String address, String port);

    // 批量添加设备转发信息
    Map<String, Object> batchSaveForward(HttpServletRequest request, String address, String port);

    // 删除设备转发信息
    Map<String, Object> delForward(HttpServletRequest request, Integer id);

    // 批量修改设备参数显示状态
    Map<String, Object> batchUpdateStatus(HttpServletRequest request, String deviceCode, String type, Integer status);

    Map<String, Object> updateDeviceEmission(HttpServletRequest request, String deviceCode, String codeNameStr, String countStr, String dayStr);

    // 同步设备信息
    Map<String, Object> syncData(HttpServletRequest request);

    // 同步设备转发信息
    Map<String, Object> syncDeviceShare(HttpServletRequest request);

    // 同步公司用户关联信息
    Map<String, Object> syncDeviceUser(HttpServletRequest request);

    // 根据条件查询分页信息
    Map<String, Object> iWebPageByParams(String openId, Integer projectId, Integer type, String startTime, String endTime, Integer pageNum, Integer pageSize) throws ParamErrorException;

    // 根据条件查询列表信息
    List<Map<String, Object>> iFindListByParams(Integer projectId, Integer deviceId, String dataCode, Integer type, String startTime, String endTime) throws ParamErrorException;

    // 根据用户OpenId获取可查看的设备列表
    List<Map<String, Object>> findDeviceEmissionInfo(String deviceCode);

    // 加载缓存数据
    void loadCacheData(HttpServletRequest request);

    // 更新设备移动端显示状态
    Map<String, Object> updateShowStatus(HttpServletRequest request, String deviceCode, Integer type);

    // 更新设备的零值预警状态
    Map<String, Object> updateZeroAlarmStatus(HttpServletRequest request, String deviceCode, Integer status);

    // 更新设备的预警状态
    Map<String, Object> updateAlarmStatus(HttpServletRequest request, String deviceCode, Integer status);

    Map<String, Object> refreshDeviceStaticData(HttpServletRequest request);

    // 通知设备状态变更信息
    void noticeDeviceStatusInfo(String deviceName, String userOpenId, Integer type);
}